lets_plot.plot.core.FeatureSpec

class lets_plot.plot.core.FeatureSpec(kind, name, **kwargs)

A base class of the plot objects.

Do not use this class explicitly.

Instead you should construct its objects with functions ggplot(), geom_point(), position_dodge(), scale_x_continuous() etc.

__init__(kind, name, **kwargs)

Initialize self.

props()

Returns the dictionary of all properties of the object in their initial form.

Returns

Dictionary of properties.

Return type

dict

Examples

1
2
3
4
from lets_plot import *
LetsPlot.setup_html()
p = ggplot({'x': [0], 'y': [0]}) + geom_point(aes('x', 'y'))
p.props()
{'data': {'x': [0], 'y': [0]},
 'mapping': <lets_plot.plot.core.FeatureSpec at 0x409b1c8>,
 'data_meta': {}}
as_dict()

Returns the dictionary of all properties of the object with as_dict() applied recursively to all subproperties of FeatureSpec type.

Returns

Dictionary of properties.

Return type

dict

Examples

1
2
3
4
from lets_plot import *
LetsPlot.setup_html()
p = ggplot({'x': [0], 'y': [0]}) + geom_point(aes('x', 'y'))
p.as_dict()
{'data': {'x': [0], 'y': [0]},
 'mapping': {'x': None, 'y': None},
 'data_meta': {},
 'kind': 'plot',
 'scales': [],
 'layers': [{'geom': 'point',
   'stat': None,
   'data': None,
   'mapping': {'x': 'x', 'y': 'y'},
   'position': None,
   'show_legend': None,
   'sampling': None,
   'tooltips': None,
   'data_meta': {},
   'map': None,
   'map_join': None}]}